
from functools import reduce


lst1 = ['a', '1', '2bb', '234', '', '9']
def func1(x, y):
    tmp_x = x
    if not x.isdigit():
        tmp_x = ''
        for c in x:
            if c.isdigit():
                tmp_x += c
    tmp_y = ''
    for c in y:
        if c.isdigit():
            tmp_y += c
    return tmp_x+tmp_y
print(reduce(func1, lst1))


lst2 = [7,-8, 5, 4, 0, -2, -5]
lst21 = list(filter(lambda x:x>=0, lst2))
lst22 = list(filter(lambda x:x<0, lst2))
print(sorted(lst21)+sorted(lst22, key=abs))


s='asd234GDSdsf23'
s_lower = list(filter(lambda x:97<=ord(x)<=122, s))
s_lower
s_upper = list(filter(lambda x:x.isupper(), s))
s_jishu = list(filter(lambda x:x.isdigit() and int(x)%2, s))
s_oushu = list(filter(lambda x:x.isdigit() and not int(x)%2, s))
result = sorted(s_lower) + sorted(s_upper) + sorted(s_jishu) + sorted(s_oushu)
print(''.join(result))